Removed unnnecessary codes.
Initialize histogram after visibility changing to fix an issue.