Fix #516, connection parameters not properly preserved