Fix the weightning of final s and final b (used to be hard coded :25000, now take the size of the vector)