Fixes process.nextTick warning and Maximum call stack size exceeded

Uploading large files using stream ran into:
RangeError: Maximum call stack size exceeded
and many :
(node) warning: Recursive process.nextTick detected. This will break in the next version of node. Please use setImmediate for recursive deferral.

This change fixes both.