Fix chdir bug during dock.  Make toolshelf_cd nicer and robuster.