fix for weeeeiiird mulitthreading issue