Fixed undefined index issue

Fixed undefined index issue