add serialisation/deserialisation methods
fix warning about unused variable