bug fix and add timer