Fixed Bug when image does not exist in the training data