fixed crash due to contrast algo, TODO find an other algo