Fixed some bugs for updating.