Fixed a potential bug in the way the stack was searched for names.