Fixed derivatives in histogram

(backported from master, see commit 92717cb65fc1b2a67be0adb01c635c6fce0a905f)
Fixed regtest

After 4525d50f4babf4db72acf0831c49055558ebac66
changelog
version 2.0.5
Merge branch 'v2.0' into v2.0-hrex