Add and improve de/serialization tests