Fix nasty bug where some parameters were double-counted