Fix issue 778:  OperationalError: (OperationalError) server closed the connection unexpectedly