Actually, I've noticed that I haven't handled the "thumbnail" case so I changed a little bit the 'if' statement.