Fixed a problem with duplicated legend.