Fixed code analysis errors

#2637