Fixing a logical issue in ST_RIDING