fixed bugs with graph