Fixed Sonar errors/warnings