Python 3 compatibility fix

Tested on Python 3.3