Apply patch for 2637, fixing off-by-one