Improve ST_IsValidDetail