working on race condition for loginPopup