added logic block to handle instances where the value for the thumbnail key was nil