cleanups and fixes, thanks to cppcheck and gcc -Wextra

8 files changed