fix issues with grayscale image