write js bug fix