Fix logic to determine if object is an array.
Update conditions and tests.