Added fix for empty graph