fix subtle timing bug