Solved some undefined indexes