Fixed DOM-to-model updating

Array indices were wrong calculated.