Relationship between oxygen stoichiometry and crystal structure in YBa2Cu3O6.5+x precursors to high-Tc superconducting materials