fix compiler/cppcheck warnings:
- unused var
- uninitialized
- params should be passed by reference (if type isn't builtin)