Update for python3 compatibility