add debug mode controllable via env var