remove useless stages.