Correctly detects current directory.