remove unnessary codes

remove unnecessary codes
1. nwritten = 0; is not necessary.
   - not anti warning.

2. variabless l, j is not used after that position.