fixing contrast check (NaN)