Update to Py3k and fix minor errors