nasty well hidden off-by-one error discovered

-also return value