added st_isvalid check for geometries in the geom table