postMessage/onMessage API fixes