added check to make sure tabs exist