javascrip bug fix