     private var bitpos:uint;
 
     public function BitArray(src:ByteArray) {
-      this.src    = src;
+      this.src = clone(src);
       this.bitpos = 0;
       this.byte   = 0; /* This should really be undefined, uint wont allow it though */
     }

        }
        return r;
    }
  }
}


      return n - 1; /* Because result in exp golomb is one larger */
    }

    public function readSignedExpGolomb():uint {
        var r:uint = this.readUnsignedExpGolomb();
        if (r & 0x01) {
