added error tolerance