fix an exception when changing tabs