Added `debug` option and fixed circular references in debug traces. Added `this.req` to the data sent to the tempaltes