Competing reactions during metalorganic deposition: Ligand-exchange versus direct reaction with the substrate surface