cppcheck fixes discovered by Andrew