Fix calculation of source index in source map

Source index is defined by specification as relative to previous occurence of this field.

Exception case when it's a first field occurence and index should be represented by whole value is also handled.