fix multithread bugs, now its really cool ha ha ha