Fix race condition that could cause page to not load