fixing auth; making more error resitant