graph test and fix bugs