fix bug in next_processes