Fix incorrect behavior in field with type array + tests