Any time you use typeof to check for an object you also need to check for null since null is also an object.

This should be

`else if (def != null && typeof def == "object")`

![selection_009](https://f.cloud.github.com/assets/439440/1460414/b2187d32-4434-11e3-9899-06417c805b36.png)