Fixed a bug where received messages would cause an exception