Fixed some issues found by sonar. #LS-15