Fix some broken math.