revamp range checks in ext/xml