Improved serialization
Bugfix