Fix thumbnail generation limiting.  Fixes #347.