Fixed crash on greyscale images