Lots of fixes for python 3

And some for changes in astropy.units api