improve implementation of invertcoordinates method in dedup