Small fix for cancelThread.