coverity fixes

Whoa, guess we need to write tests with this sort of thing.