Retry function fix