I too have this problem. Do you still get the error when all the code in the function is comments out?
I do.