fixed graph check
catch exception on empty input