fix bug that thread is not increasing and add a timer