Solid state synthesis of YBa2Cu3O7-x: mechanisms of BaCuO2 formation