Update failing tests and make more robust