destroy old graph before creating new graph