Edits for PostGIS 2x support (minimal!)