Some bug fixes found while debugging a different bug.
Some bug fixes found while debugging a different bug.

nmav/nss,nmav/nss,nmav/nss,ekr/nss-old,nmav/nss,ekr/nss-old,nmav/nss,ekr/nss-old,ekr/nss-old,nmav/nss,ekr/nss-old,ekr/nss-old,ekr/nss-old,nmav/nss