Latest changes from astropy core package

This includes fixes from:

https://github.com/astropy/astropy/pull/2353
https://github.com/astropy/astropy/pull/2198
https://github.com/astropy/astropy/pull/2214
https://github.com/astropy/astropy/commit/0354ed6f758a9ef2d8af5de74933e5e7c093779e