operations: fix a bunch of uninitialized memory errors found by valgrind