Issue#12 jsbugs

Fixes #12