Fix to maintain correct selected index on refreshes