fix bug--disable ui at inappropriate time