understood and fixed problem in js