Fixed bug related to destruction of NULL object.