hack to fix a bug with the thread