Fixed some bugs in deleting error messages..