rewrite code to not have warnings about not defined indexes, variables,
or not being able to write files
Merge pull request #63 from bifek/thumbwarnings

quiesce warnings