Added clone() to writeSnapshot too
Clone works correctly for undefined documents