Fixed bug when updating ui