fixed flagging bug when posts have been deleted