Hi Ali,
Without spending too much time on your code, I’d double check you have something set up to increment through the most recent posts? It sounds like your if statement may be receiving the correct number of post to show (i.e. set to 2 it shows 2 posts, set to 5 its shows 5), but there may not be anything in your if statement that retrieves the newest post, and then works back through the next newest event.
Neill