fixed the issue where the timing loop freezes