fix build error and compiler warning