update UI and db