fixing logged-in check