Fix length check for highlight regions