fix npe in tests, and, probably, elsewhere