solve "warning unused variable i" compiler warning