fixing pg connect logic in Samples