delete or insert when looping