various patches to smf