Fixed lots of compilation errors