Some fixes for scrutinizer reported issues