Check an array's length properly