A fix and some cosmetic work on tests