added exception handling in ggplot extractor