fix build and code analysis warnings