implement cloner and json encoder