Fixed compilation errors and warning