Refined the browser resetting logic