added a check for undefined options while extending

While extending the options if any option is undefined then that should not be added. Added a condition to resolve that.