Fixed getPosts API issue