Multiple pages not getting resolved properly, race condition with global variable

Check last spec in this pull request.