correct deserialisation function.