fix up a few buglets found using clang