chdir works better

doing it this way will make it so that your program won't error out when you cd to the directory first, and then run the program.