Fixed some issues with the hist function

See https://groups.google.com/forum/#!topic/julia-users/VPbQgaz3xgs

The strange code was introduced in https://github.com/JuliaLang/julia/commit/a95f79c307c31dcbd7cb0764ef9354f8d07be5a3

cc @lindahua