[patch-warnings] fix some warnings when to inexsitant array indexes

so you can remove the foreach statement now ;)