Properly look for encoding in first ivar from marshal stream.

Fixes #939.
Merge remote-tracking branch 'origin/master'