ImageIndex -1 crash fixed. Closes #1688