Update UnsafeBitStream and allocating memory