change bmp funtion in order to fit 24-bit