fix for multithreading in python <2.7.2