Fix custom serialization. Implement reading custom digests. Fixes #3.