fixing contact logic