Fix Ztable memory leaks
Merge pull request #177 from moshekaplan/patch-6

Fix Ztable memory leaks