Fix some Scrutinizer issues

Need a review and some tests.