Applied fixes suggest by Scrutinizer.