STSM: various minor bug fixes