Fixed bug in handling multiple uses of global object.