Structural and superconducting properties of oxygen-deficient and doped YBa2Cu3O7−x