Fix Ztable memory leaks