fixing timing bug