fixed problems found by sonar