Fixed the check for the right page