Fix bug handling sm_sd in past context