Fixed compilation error and warnings