Fix a problem that tries to change the current directory to wrong one.