fixed error when input line contain duplicate coordinates