Fixed error in range header calculations