fix for multithreading, i know, original :D