Some fixes related to sonar findings.