Fixed bug with getting legend values