wip: fixed wrong deallocation