Mitigating the Hidden Risks of Factor Investing