Changed string handling to work with Python 3.2