Reindexing the switch's ports. Missed commit.
Some error handling.