Preventing foreach-errors

Loops calling "extra_tabs" as an array is prevented with an
if-statement.