some fixes for python mode