completed py3k compatibility upgrade