Fixing problem when colorspace is not RGB