Fixed issues reported by Sonar.