fix for incorrect offset lengths being used