Changed the order of this logic so it doesn't die when image is None