Major/minor fixes brough up by Scrutinizer