bug exists if a top-level object is undefined

To replicate:

```window["hi"] = undefined; ```
sync_collections()