add graph tests, fix resultant bugs