Theoretically the electoral college was supposed to prevent guys like Trump from becoming president. Isn't that ironic?
It was badly engineered.
And it was overly confident on trust over the course of events and human nature - while you are obliged to do the opposite.