Fixed bug that throws warning if array index not found