Bug fixes in the histograming scripts