Finally got PG working correctly