Fix for py3 compatibility