fix for dupliate output for each unique record