Correctly compute offsets.