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){
i = 0;

Any help would be great
Thank you

Post your complete code in code tags