fixed bug with undefined pages