Fixed bug in deserialiser, fixed unit tests