Some fixes as pointed out by Scrutinizer.