merge from trunk. util.py: yuck, they changed the calling type for embedded ipython. also ensure we exit after leaving debug shell