Update for Python3 compatibility