Fix UI logic problem