Fix boundary overflow