Fix encoding `nil` values in arrays and composite types

Closes #20.