Measurement of charm production in deep inelastic scattering at HERA II