nullptr check when deleting fix