Fixed rateThread()