handling automatic mode exit