fixing database update procedure