Fixed a lot of things for JavaScript version