Minor fixes to stmd.js (non messed-up version)

I have double checked this edit - 5 changes, which is much more like it :)

Thanks

Steve