add configurable switch for initial fit
fix mismatched variable indices