fixing delete image and empty directory when a message is destroyed