fixed incorrect assignment
assignment was writing over memory location i, instead of addr+i