Fixed a small bug + added retry logic