diff --git a/doc/ChangeLog b/doc/ChangeLog
index f9c0108..380f628 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -1,5 +1,8 @@
 2006-10-28  Fernando Perez  <Fernando.Perez@colorado.edu>
 
+	* ipython.el (py-execute-region): apply Stefan's patch to fix
+	garbled results if the python shell hasn't been previously started.
+
 	* IPython/genutils.py (arg_split): moved to genutils, since it's a
 	pretty generic function and useful for other things.
 
diff --git a/doc/ipython.el b/doc/ipython.el
index dc624a9..a123605 100644
--- a/doc/ipython.el
+++ b/doc/ipython.el
@@ -6,7 +6,7 @@
 ;; URL:           http://ipython.scipy.org
 ;; Compatibility: Emacs21, XEmacs21
 ;; FIXME: #$@! INPUT RING
-(defconst ipython-version "$Revision: 1823 $"
+(defconst ipython-version "$Revision: 1851 $"
   "VC version number.")
 
 ;;; Commentary 
@@ -250,9 +250,9 @@ buffer already exists."
 (defadvice py-execute-region (around py-execute-buffer-ensure-process)
   "HACK: if `py-shell' is not active or ASYNC is explicitly desired, fall back
   to python instead of ipython." 
-  (let ((py-python-command (if (and (comint-check-proc "*Python*") (not async))
-                               py-python-command
-                               ipython-backup-of-py-python-command)))
+  (let ((py-which-shell (if (and (comint-check-proc "*Python*") (not async))
+			    py-python-command
+			  ipython-backup-of-py-python-command)))
     ad-do-it))
 (ad-activate 'py-execute-region)