Messages can now be marked as read.

Fixed some bugs here and there:
If no messages from the database the program access not good memory