working (but may be still unsafe) nested multiprocessing solution