fix color calculation