fix #21 memory leak in the Haskell API