BUG: Fixed SQL escaping issue in RegionRestriction code