Fix for locating frames by name

If a site has frames that have no name or id, the iteration can error out early because j is null. By first checking that j isn't null or undefined, we avoid breaking this.