Added tolerance in boundary check, as well as warning message