fix element numbering which should be in display order