fix log histogram logic