Corrected histgram bugs