keep stack with nlocals instead of nregs; fix #1706

#1706