Fix issue with undefined array value check