Fix off-by-one in dirty bitmap functions