Fixed a bug with not clearing graphs