Corrected handling of magSf and limit the opening to avoid /0.