#8 fixed bug in JS