Fix Py3 compatibility check