Some debugging improvements