fixed some edge cases for saving messages