sp bugfix: undefined refs in debug functions spoil debugging