Bad beats happen whether you play correctly or not. You just increase your long-term profit by playing well; you don't guarantee that every pot will go your way. You had the best hand here but it was still only 65/35 in your favor vs. the trips.