Fixes a really dumb bug and cleans up some debugging code.