Fix incorrect reading of length attribute.