Avoid crash if p.have.n is 0

Work around issue #54.