bug with restore counter not resetting