Updating some logic on save to prevent bad indexes.