Correct the searching of sinks and sources