Properly look for encoding in first ivar from marshal stream.

Fixes #939.