Some minor cleanup / fixes, most to make Python 3 work