Improve removal of STB (issue #3923)