diff --git a/ginga/util/io_fits.py b/ginga/util/io_fits.py
index <HASH>..<HASH> 100644
--- a/ginga/util/io_fits.py
+++ b/ginga/util/io_fits.py
@@ -294,7 +294,11 @@ class PyFitsFileHandler(BaseFitsFileHandler):
                 numhdu = _numhdu
 
         self.logger.debug("HDU index looks like: %s" % str(numhdu))
-        hdu = self.fits_f[numhdu]
+        if numhdu not in self.fits_f:
+            info = self.hdu_db[numhdu]
+            hdu = self.fits_f[info.index]
+        else:
+            hdu = self.fits_f[numhdu]
 
         dstobj = self.load_hdu(hdu, dstobj=dstobj, fobj=self.fits_f,
                                **kwargs)
Fix for reloading HDUs that drop out of the cache

- With certain files, the HDU name of (name, extver) is not a valid
  index into the astropy HDUList.  If the key isn't found in the HDUList
  we index into the hdu_db that we created when opening the file, look
  up the numerical index and use that to access the HDU