fixed a foreach bug, improved stack dumping to minimize drama