Fix code analysis violations