Added support for Python 2.5 and fixed bug when retrieving error string