Fixed segfault on image removal with uninitialized thumbnails; fixes issue #177