fix err_stop and add on_err