Fix various minor issues found by the code inspector