Fixed loading and saving for grayscale images