script corrected for length gauge