added stash() back, replacement for scope()
fixed test errors caused by server-modified headers
changed trigger_error() calls to exception throws