Fixed backup naming loop and duplicate variables.