Minimal patches to get the embedded terminal working on py3k