fix build warning and errors