use disconnect only if available - fixes #770