Making the code more defensive.