added logStack() helper