Fix gallery plugin crash. Use correct loop variable name.

Seems like a copy/paste error was made.