Added ST_IsValid in where clause