Limit chdir to where required.