fixed buggy js