Fix #166 for js