Fix bugs on updating