A bunch of small changes from scrutinizer-ci; some tidying, some actual bug fixes