fixed setTimeout issue