fixing bug in rgb2gray