The electoral college was specifically designed so the person who won the popular vote could still lose the election. When this happens, it's not a flaw. It's literally working EXACTLY as it was designed to do.
The reason this is important is because it prevents the big cities from destroying the rural areas of the country which are what actually keeps the ball rolling in our society (oil, natural gas, manufacturing, mining, farming, etc). When policy changes that make sense to city-living people wreck the lives and livelihoods of the people in rest of the country, ultimately the entire system comes crashing down.