Move chdir after mkdir.
Merge pull request #2 from iakio/chdir

Move chdir after mkdir.