Fixed some messages and events not being handled properly