worked for hours to fix insert/delete