Fix overlaping operands when calling memcpy