add defensive code for missing fields