corrected delete message functionality