Fixed undefined array index