This time it's the mas[0] that is wrong.

What does your function expect as second parameter, a var or a series?