Fixed a BIG bug in JS