fix isValid(Polygon), mix between ri/rj