diff -ur gschem-orig/noweb/x_preview.nw gschem/noweb/x_preview.nw
--- gschem-orig/noweb/x_preview.nw	2005-01-27 19:31:22.000000000 +0100
+++ gschem/noweb/x_preview.nw	2005-01-27 18:57:32.000000000 +0100
@@ -95,7 +95,7 @@
 
   /* Since f_open now changes the directory, we need to 
    * use this to reset the cwd at end of fcn */
-  cwd = getcwd(NULL, 1024);  
+  cwd = g_get_current_dir ();
 
 #if DEBUG
   printf("%s %s\n", directory, filename);
@@ -128,8 +128,7 @@
   chdir(cwd); /* Go back to original directory */
   free(cwd);
   free(temp);
-
-  return;
+  
 }
 
 
