Fixes invalid dictionary access.

Fixes an invalid dictionary access, which threw a KeyError. Now it defaults to None.

Also optionals should be a dictionary instead of an array, since we got strings as keys.