minor fixes revealed by new tests