Fix code to respect warnings