+fix off-by-one count