Fixed the logic to move to the saved array

I've extracted this from #317.