fix bug with num_processes