lots of hacking to make emscripten get closer to working