fixed the registration of the message event-listener