add retry function when failed