Either you cache has stale data or your system is not fully in sync with the changes, otherwise i cannot see how this is happening in your system since i cannot replicate in 3 systems here.
Debugging info: to verify this check that the $tabscount is getting incremented in the loop after the form is declared since you seem to have to interfaces that should be shown there.