Fixes bugs in messaging