fix exception on end_of_stage with default script