Improved error tolerance; added test.