fix the threading error