add typeof to check event.data