Fixed a segmentation fault in the options handling.

There was no space for the last NULL, and the indexing for adding the last
NULL was also wrong and out of scope.