Fixed bug by replacing call to chdir with a call to path