First round of fixes of log scaling based on code review from danvk.