Guard against undefined

Guard against undefined

Will also submit a PR to the library