Fix to bug introduced in python3 compatibility