improve timeout logic, fix UI bugs