Fixed a few problems, added a debugging configuration variable