Rep 1039 sonar fixes

Quick sonar fixes round 1 
Please add some parenthesis to make this more clear