Fixed problems reported by real_test and optimized error tolerance.