Fix serialization
Merge pull request #1 from riking/pr-1393

Fix serialization