Fixed some page switching bugs.