some minor changes to output_stage.