Fixed segfault caused by image removal in thumbnail mode