added retry code