Fix the function that marks graphnodes dirty when a function is redefined