Is this really caused because of multithreading? Or is it related to the scope of variables? I'm confused.