fixed insert unintentionally deleting elements