Fix static analysis problems