fix error with pages undefined