improved cache + fix in re-login code after api timeout