What does symbol mp represent and how is it related to j? In generally it is a bad idea to introduce symbols that might class with something already present. You should probably be using a Dummy('mp') -- but I'm even nervous about this, not understanding why this branch is here if j is not a number. (Sorry -- I don't know the internals of these routines, so if you could explain the rationale, that would be helpful.)