fix chaining for more than 2 processes, thanks to @volaya (closes #100)