check null first, then check isArray