fixed setting of root pointer at wrong time