adding error handling for missing objects in arrays of references