only include details that actually exist
Merge pull request #3887 from dimagi/details

only include details that actually exist