fixed several "major issues" reported by sonar