fix bug handling sm_sd in past context