Fixes an exception when removing an added transient item before it has a valid id.