Make #305 python 3 compatible