[Code] Fixed undefined index warnings