Fixing some sonar warnings