Improve retry logic for Stale Element Exceptions

@wedaly