These are both bad beats, there is nothing stupid here... But looking at the first hand, I think tightening your early position range could help your game a lot. And also I suggest not to limp anything UTG...