Fix some issues with flynn-postgres providing env.

It didn't really do so at all before.
Fix wrong exception import.