Handle different postgis versions; remove dead code