This is a bug -- it should be comparing against updated[j], not updates[j].