fixed bug in messages model