a simple impelementation of copy on write object