js code change

thanks to @Snack-X