Fix indexing
Fixing summation limits