Made changes based on Coverty evaluation.