fix Undefined index exception