Magnetic resonance fingerprinting is a methodology for the quantitative estimation of the relaxation times T1,2. An important challenge is to make estimation robust to inhomogeneities of the main magnetic field B0. Free precession sequences with smoothly varying parameters, such as balanced hybrid-state free precession (bHSFP) sequence, can be optimized for T1,2-encoding performance. Previously, magnetic field deviations were assumed to be determined by a separate experiment. Here we develop a numerically optimized bHSFP sequence that takes into account variations in B0 with the aim of mitigating bias due to B0 inhomogeneities. Our numerical results indicate that this approach yields accurate T1,2 estimates when B0 inhomogeneities are unknown.