Fix issues raised by Scrutinizer