Fix python buffering