fixing graph builder thread saftety