added automatic reauthenticate