QTR-8A not read correctly

You will probably want to break away from your normal PID control while you are not on the line. So the logic would be something like:

Detect that the line has disappeared.
Break away from your PID control
Drive straight while checking the sensors for the line.
Go back to PID control when the line has been found.

A condition of position==0 is probably not the most reliable way to detect that the line has disappeared, since the readLine() function remembers where it last saw the line (e.g. if sensor 4 is your rightmost sensor and you end up completely off the line to the left, this function will continue to return 4000). Instead, you could check the calibrated values in the array you passing the readLine() function to check each sensor and see if they are all seeing white. More suggestions can be found in my posts in this thread.

Brandon