Fix couple of "undefined name" errors

Pyflakes reports lots of false positives with astropy. However a few seem to be actual errors.