fixed some issues reported by Sonar