refactor serialization tests