fix minor bugs in SM