fixed a bug of generate_post