initialize ptr to the root

ptr = root;