Fix off-by-one bug in pbm