better handling of array and nullable types (fixes issue #9)