Maybe assert that it is defined before you remove it?