fix sonar critical issues