fixed bug about switching pages