Fix #249 for JS backend