fix run loop bugs