Added checks to prevent exception on missing data.