Fix PWD detection.