Fixed so pages are updated in the tree when chaning state.