fix some Sonar major issues
fix some Sonar hotspot issues