corrected segfault when plots or plants is empty. corrects issue#3