Fixed bug in diffusion calculation in 2nd order stats
Merge branch 'masterupstream' into cudaupstream