fix build warnings and errors