Minor tweaks to support Python3