Fixes for Python 2.5 and Python 3.*