Fixed data-original-index generation. Closes #819

Also closes #824
Also closes #826