Changed the end-of-wait condition to 500, instead of 5XX.