fix py-3 compatibility