Couldn't you rely on oldTree being undefined instead?