fast modify to make it working on Python 3.2