fixed two critical sonar issues.