Fixed unexpected crashes in shelves