Added logic of reference() to the same object with same data without copy-on-write.