fix graph generation bug