patch to fix Python 3 incompatibility