adjust situations: chenge "if viewInstance is None or else" int mainthread