fix JavaScript module

Fixed some bugs on version 0.3.