Code inspect fixes from the inimitable Nami-Doc