Fix onMessage callback setting