Fix issues found in scrutinizer