Fixing a bug where the OnMessage event listens to messages emitted from itself