Fixed some sonar warnings