#19 - fixed various bugs in serialization