Fix undefined indexes.