Cast should work with array types as well

If type = ['null', 'number'], cast should still try to cast to
number if value exists