fix event insert or update