Fix an off-by-one in managed::refcount

This fixes a bug I accidentally introduced in #9922