use proper “if” construct for selected changing on toptab;
also only do this if we are in use, too

similar to commit 5851697ef4b2bcd3b69717fa080deeed31c98ee1