fix for insert and update