Added a check for the posts count