Wip scrub coverity

Fix a few minor issues detected by Coverity.