Fix integer truncation in width calculation