Fixes to make things work properly for inserts