added some hooks for ipython