Fix indexing bug in freeimage plugin (closes #1111)