get rid of trailing repeated fields