fix #263: _sm has a memory leak