update to try to make it work in both node and in the browser