Fixes for compilation\n\nStill needs testing.