fixed pipe and add chdir