Attached is a patch fixing this.
One question I do have:
if (target->savepointLevel != s->savepointLevel)
Will this ever be true in the current code? I cannot see anything settingsavepointLevel explicitly.
Gavin