The flaws were within the individual states that allowed slavery, not the federal government.
I agree that individual state were flawed by slavery. Yet, the US Constitution was also flawed in apportionment by counting free people (ok), excluding Indians outside the system (ok), yet counting as three fifth all other Persons (not ok as it is a backhanded acceptance of slavery). We just disagree.
Article. I. Section 2 - The House
....Representatives and direct Taxes shall be apportioned among the several States which may be included within this Union, according to their respective Numbers, which shall be determined by adding to the whole Number of free Persons, including those bound to Service for a Term of Years, and excluding Indians not taxed, three fifths of all other Persons....
The flaw was that the courts allowed it.