Bug fix to python mode.