Serializable: overwrite writeObject and readObject.