use thread instead of timer to fix incorrect timer interval