Fixing some Sonar warnings