fixes PR #171. better postgres support