Fixed compilation problems and warnings