Fix color calculation