fix bug on scheduler is stopped when exception is thrown