Fix Python3 compatibility