Fixed bug in joint hist function