fixes bug with pages not loading correctly