Fix a bug with undefined value