Return undefined, if the field is optional and no values are set.

Currently, getting the value from optional field occurs error if value
is not set. It's a bug.

This patch makes it return an undefined.