Fix issues pointed out by scrutinizer