Improved index determination in image stack imports

Will update indices when the prefix is changed.