Additional check before creating graph. Fixes #12