Fixed a crash related to messages