Added better AutoChDir workaround