Remove duplicate result at end of array