implemented SEM and fixed some weird things in the ODEs