fixing redefinition of i