Added more tests for error tolerance and fixed problems which occurred.