hardening get_top_posts, fixing error that debugger throws