fix crash on RGB images