Fixes bugs for when trying to log out from a page different than the one in which the user signed in