Fix PostgreSQL multiple connections problem