#177 fixed. deallocation moved to finalizer