fixed small error in state extraction