error protection for stack-ref