fixing delete and insert