Serializer fixes

This fixes #160