Fixed bug with scan indices and energies

Error occured when indices were not used. This was due to
mismatched variable names.