Added a check for the width, in case it goes over the vector size.