fixed most critical sonar issues

fixed most critical sonar issues