Fixed compilation errors on linux (with more hacks).