fixed timing bug