Fix gallery plugin crash. Use correct loop variable name.