When to leave a troubled company