adding some failsafe code to connect2postgres2