Corrected bug throwing error when not logged in