fix clock timing bug