XYZ File writes properly but incorrect connections