fixed js code