Fix autochdir issues

Fix #36
Fix #46