Fixed Undefined index issue