fix onMessage method