Fix bug when user uploads non-jpg images.