remove duplicate end in finish