fix an issue with converting dart object to javascript

Fixes #123.

@financeCoding @a14n

I'm a little leery about this change since we don't have good test coverage. I did make sure that the demo app still runs properly. Comments welcome!