take care of cases where array-like object is undefined