fix dgnode_stack concurrency problem with lambdas

Instead of incrementing a counter we use two lambda-functions
to address the current and future stack-address.