Fix to check for global object