[0.3] Add smooth migration for session (de)serialization

Fixes #517.