Update smartReset() to avoid infinite loops

Limits the number of times smartReset() can be called so that we
can avoid getting into an infinite loop.