Updated to work with PG 2.7