Correction to place chdir in correct spot