fix a bug which prevented thumbnail generation in some cases