Well, X should sue for crappy work, not unilaterally decide not to fulfil their part of the agreement that seems in one way or another to be in place. And even without written contract, if they were paying bills, they still acknowledged some kind of contract was in place.