Fixes a memry leak when a value is casted to a type which has deallocator