finally fixed the timing mechanism