serialization tests; fix corner cases