exit when alert and redirect