Fixed bug in the IsSubTree code