Accum is not reset in the loop