fixed variable name typo (sim.params --> params)