Fixed TypeError on Python 3