Fixed stack overflow when mapping recursive collections

Closes #713