fixed a rare bug with multiprocessing and infinite recursion