Remove unused variable in loop