Fix calculating last match in update