some off-by-one errors