"Looks like there is a problem" ??
What does that mean? What evidence suggests there is a problem, vs what you would see if it worked properly?
Please show us the code (use code tags) that makes up your function; show us (copy + paste from your console) the procedure you are following in executing this code or function, so that we can see for ourselves, what might be going on.
We can't read your mind
-- you gotta show us
-- error messages, code, etc.