Emscripten

Fixed a bunch of stuff which made Emscripten build fail.

Fixed warnings when building unit tests.
@petya2164 or @mortenvp any comments regarding this fix?