Fix mismatched new/delete mechanism found by valgrind