improved auth handling