fixing error in js