py3k compatibility bug fixes and minor updates