try to fix TypeError issue by diagnosing it as a QUnit problem and refactoring around it

* Fixes #441 (perhaps!)
* Jenkins: http://jenkins.buttonweavers.com:8080/job/buttonmen-cgolubi1/100/