synched changes in JS for node/browser compatibility