error handling + retry

added error handling