Fix debug bug and re-add below, still doesn't really work in tornado