detect collision and insert only valid rows
detect collision and insert only valid rows