bugfix for #18

* fixes cannot call method 'toString' of undefined
0.6.1