fix casting to prevent emscripten Casting potentially incompatible function pointer errors