fixing the array distinct method