Fixed issues reported by sonar