Fixed bug in js