Fixed bug that caused 500 error when user not logged in