Fix bug in image display of dendrogram and add cache