Default not returned bugfix

Catching a broad exception to ensure the return of the default, added te...sts, fixed a bug where obj.contains(obj) returned false, added test case.
Whitespace or other unrelated changes should be submitted as a separate PR.