Some minor bugfixes caught by clang
Fix a compiler warning