Fix py3 compatibility