contrast calculation bug fixed