Fixes issues found by scrutinizer-ci