Function issue

seems like a bug.
but make sure that each function has a unique name not just function or whatever the default is.
when you are duplicating it makes sense for the variables to be changed in both places because those are references.