Memory leak resolved. fixes #9