updated deletePost function