Fix some issues with multiprocessing.