Fix crash

Pass the correct length when copying the original value to the new one.