fix undefied index