Sensor Value Changes when potentiometer> Why?

I have a capacitive level sensor I made it works great. When water touches it it lights and LED for testing
I am adding a potentiometer to delay the light ON when water touches it.

For some reason the sensor value increases as the potentiometer increases. This is with no water in contact with the probe.

I have made and equation to balence it out. But this only works in the extreames of the potentiometer.

probe_reading = analogRead(IN_PIN);
pot_value = analogRead(pot_pin);
delay_interval = map(pot_value, 0, 1023, 20, 1000);

probe_value = probe_reading - (delay_interval/1000 * 300);

if(probe_value < critical_value){
digitalWrite(alarm_LED,LOW);
digitalWrite(COM,LOW);
//Serial.print(“0\t”);
i = 0;
}
else{
digitalWrite(alarm_LED,HIGH);
digitalWrite(COM,HIGH);
//Serial.print(“1\t”);
}

Any help would be great
Thank you

Post your complete code in code tags