bug fix to js