use typeof helper for array check