fix for database insert ad update