js code bug fixed