Some minor cppcheck-found fixes

EDIT: Now with more unrelated fixes!