login and authenticate bug fixes