add object id to streams to prevent infinite loops.

fixes http://bugzil.la/1020858
Merge pull request #4907 from CodingFabian/fix-4906

add object id to streams to prevent infinite loops.