Fix check for max posts.

Corrects the check for exceeding max allowed posts and tweaks the deletion loop for clarity. 
Fixes #2192