Sonar fixes

Fixes for sonar violations
Merge branch 'sonar' into 4.x