Fix issues that were found by Scrutinizer