Fixed issues reported by sonar
Fixed a new issue that came up in sonar after fixing other things
Merge pull request #256 from jewzaam/sonar-fixes

Fixed issues reported by sonar