fixes a null pointer problem on remove