Checked for the name when looking for a key in globals.

The original code doesn't seem quite correct in that it is checking for the globals as a key of globals and then throwing an exception saying that name doesn't exist.  Checked for name instead.