Fix incorrect graph generate when a function is used inside a class