fixing callbacks on postMessage mode