core: Ugh, off-by-one errors