add null check for missing attributes