chdir properly to parent directory