Fix infinite loop in logged_in? method