Reorganize database update code, fix async itemdisplay error.