fixes bug with switching pages when popup is active