fixed load_posts function