Fixed buggy js