Fixed issues found by Sonar