Corrected thumbnail creation.

Because some systems do not allow file overwriting when doing a
rename().