fix checkIfPageLoaded checks