Fixing class so messages are saved properly