Fixes for newer versions of astropy and numpy