Corrected a error in the timing loop